﻿using K9Nano.Captcha;
using K9Nano.Domain;
using K9Nano.Drawing.SkiaSharp;
using K9Nano.Drawing.SkiaSharp.Internals;
using Microsoft.Extensions.DependencyInjection;

namespace K9Nano.Drawing;

public static class SkiaSharpStartupExtensions
{
    public static IK9AppBuilder UseSkiaSharp(this IK9AppBuilder app, Action<CaptchaOptions>? optionsAction = null)
    {
        app.Services.Configure<CaptchaOptions>(optionsAction ?? (o => { }));
        app.Services.AddSingleton<ICaptchaGenerator, SkiaSharpCaptchaGenerator>();
        return app;
    }
}